import React from 'react';

const Huxubo = () => {


  const zimuindex = localStorage.getItem('zimuindex') ? localStorage.getItem('zimuindex') : undefined
  const [huxubo, sethuxubo] = React.useState(zimuindex)
  return (
    <div>
      {huxubo === undefined ? '里面没有数据' : huxubo}
      <button onClick={() => {
        localStorage.setItem('daliebiao', JSON.stringify([{ '_id': 'jdsafsdfhjasdfd8', 'name': '易经' }, { '_id': 'jdsafsdfhjasdfd3', 'name': '八字' },
        { '_id': 'jdsafsdfhjasdfd8', 'name': '起卦' }]))
        localStorage.setItem('daduixiang', JSON.stringify({ 'name': '伏羲老祖', 'age': '10000', 'sex': '男', 'zhiye': '神算子', }))
        sethuxubo('我是你大爷的')
      }}>修改数据的值</button>
      <div
      //  style={{ display:'flex',width:'100px',height:'100px',background:'#ccc',margin:'10px',justifyContent:'center',alignItems:'center',color:'#fff',border:'1px solid #ccc',borderRadius:'10px',borderBottom:'1px solid #ccc'}}
      >
        {/* <h1>开始你的表演</h1> */}
        <div   >
          {
            localStorage.getItem('daliebiao') ? JSON.parse(localStorage.getItem('daliebiao')).map((item, index) => {
              return <div

                key={index}>{item.name}</div>
            }) : '里面没有数据'
          }
        </div>

      </div>
    </div>
  );
}

export default Huxubo;
